using System;
using System.Collections.Generic;
using System.Text;
using GarageGames.Torque.T2D;
using GarageGames.Torque.Materials;
using Xyne.Components;
using Microsoft.Xna.Framework;
using GarageGames.Torque.Core;
using Microsoft.Xna.Framework.Graphics;
using GarageGames.Torque.Util;
using Xyne.Objects;
using GarageGames.Torque.Lighting;

namespace Xyne.Templates.PuzzleGlowTemplate
{
    public class PuzzleGlow : T2DStaticSprite
    {
        private static PuzzleGlow template = new PuzzleGlow();

        public static PuzzleGlow Template
        {
            get { return template; }
        }

        public PuzzleGlow()
        {
            // Set the template and name
            IsTemplate = true;
            Name = Game.PuzzleGlowName;

            // Size and collision parameters
            Layer = Game.PuzzleGlowLayer;
            Size = new Vector2(Game.PuzzlePieceWidth, Game.PuzzlePieceHeight);
            ObjectType = TorqueObjectDatabase.Instance.GetObjectType(Name);

            Material = (LightingMaterial)TorqueObjectDatabase.Instance.FindObject<LightingMaterial>("GlowLightMaterial").Clone();
        }

        public override void CopyTo(TorqueObject obj)
        {
            base.CopyTo(obj);
        }

        #region Static Accessors
        public static PuzzleGlow GetNewPuzzleGlow()
        {
            PuzzleGlow glow = (PuzzleGlow)PuzzleGlow.Template.Clone();
            glow.Name = Game.PuzzleGlowName;
            glow.Visible = true;
            T2DLightComponent lighting = (T2DLightComponent)TorqueObjectDatabase.Instance.FindObject<T2DLightComponent>("GlowLightComponent");
            if (lighting != null)
                glow.Components.AddComponent(lighting);
            return glow;
        }
        #endregion      

    }
}
